<%--
 *  File:    usrmonitorcurrentsummary.jsp
 *  @Author: Kent Zhong 
 *  Date:    2002/04/22
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>
<%@ page import="java.text.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom-tag.tld" prefix="customnew" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.usrmonitorSummary");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "IMG";
  	String strTableName = "ovforum";
	String privilegeCode = "Z0103";
  	
  	//get current userinfo
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  	cat.debug("The userinfo is :"+CurUserInfo);
  	cat.info("enter my page");
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>usrmonitorcurrentSummary</title>
<PageFlow:CheckPageFlow pageName="usrmonitorcurrentsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<script language="JavaScript" src="../js/Calendar.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script language="JavaScript" >

    function page_summary(actionvalue,orderbyname)
	{
	  if(!checkForm(usrmonitorsummaryform))
	  {
	    return;
	  }
	
	  if(!checkDate(usrmonitorsummaryform.logindate_start_D,usrmonitorsummaryform.logindate_end_D))
	  {
	    return;
	  }  
	  
	  usrmonitorsummaryform.logindate_start.value = dateTransform(usrmonitorsummaryform.logindate_start_D.value,"yyyy-MM-dd",'<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')+" "+usrmonitorsummaryform.logindate_start_T.value;
	  usrmonitorsummaryform.logindate_end.value = dateTransform(usrmonitorsummaryform.logindate_end_D.value,"yyyy-MM-dd",'<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')+" "+usrmonitorsummaryform.logindate_end_T.value;
	  var editform = summaryPrepare(usrmonitorsummaryform,actionvalue,orderbyname);
	  editform.action = "usrmonitorcurrentsummary.jsp?<%= OvalTools.randomURL() %>";
	  editform.target = "_self";
	  isRunning = true;
	  editform.submit();  
	}
	
	function checkDate(startdate, enddate)
	{
    if (!isEmpty(enddate))
    {
      if (toDate(startdate, '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>') > toDate(enddate, '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>'))
      {
        alert('<%= message.getMessageDesc("DATE1_SHOULD_NOTLATE_THAN_DATE2") %>');
        return false;
      }
      return true;
    }
    return true;  
  }
  
  function checkTime(ti)
  {
    if(!isTime(ti.value,"xx"))
    {
      alert('<%= message.getMessageDesc("DATE1_SHOULD_NOTLATE_THAN_DATE2") %>');
    }
  }
	
	
	
<%--[SCRIPT]    [SCRIPT]--%>
</script>
</head>
<body>
<form name="usrmonitorsummaryform" method="post" action="../Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="usrmonitorcurrentsummary">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <input type="hidden" name="mark" value="1">
    

<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr> 
    <td valign="top"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0"  onkeydown="if(event.keyCode==13) page_summary('search');">
          <%
                SimpleDateFormat formatter1 = new SimpleDateFormat ("yyyy-MM-dd");
                SimpleDateFormat formatter2 = new SimpleDateFormat ("HH:mm:ss");
                
                if (pageContext.getAttribute("logindate_start") == null) {
                
                
			            pageContext.setAttribute("logindate_start", java.sql.Date.valueOf((new java.sql.Date((new java.util.Date()).getTime())).toString()));
                }
                
                java.sql.Date logindate_start = (java.sql.Date)pageContext.getAttribute("logindate_start");
                
                String str_logindate_start = formatter1.format(logindate_start);
                String str_logindate_start_T = formatter2.format(logindate_start);
                
                if (pageContext.getAttribute("logindate_end") == null) {
			            pageContext.setAttribute("logindate_end", new java.sql.Date((new java.util.Date()).getTime()));
                }
                
                java.sql.Date logindate_end = (java.sql.Date)pageContext.getAttribute("logindate_end");
                String str_logindate_end = formatter1.format(logindate_end);
                String str_logindate_end_T = formatter2.format(logindate_end);
                
              %>
      
          <tr>
            <td class="red"><%=label.getLabelName("L_UM_LoginDate")+label.getLabelName("L_Colon")%></td>
            <td>
              <custom:text property="logindate_start" changedName="logindate_start_D" dataType="date" dataFormatName="dateformat" command="notnull" module="IMG" label="L_UM_LoginDate" size="10"/>
              <a onclick="javascript:c.show(this,'usrmonitorsummaryform.logindate_start_D','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
              <input type="text" name="logindate_start_T" value="<%=JspHelper.filterNull( str_logindate_start_T)%>" onchange="checkTime(this)" size="10" command="notnull" module="IMG" label="<%=label.getLabelName("L_UM_LoginDate")%>">
              <input type="hidden" name="logindate_start">
              -
              <custom:text property="logindate_end" changedName="logindate_end_D" dataType="date" dataFormatName="dateformat" command="notnull" module="IMG" label="L_UM_LoginDate" size="10"/>
              <a onclick="javascript:c.show(this,'usrmonitorsummaryform.logindate_start_D','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
              <input type="text" name="logindate_end_T" value="<%=JspHelper.filterNull( str_logindate_end_T)%>" onchange="checkTime(this)" size="10" command="notnull" module="IMG" label="<%=label.getLabelName("L_UM_LoginDate")%>">
              <input type="hidden" name="logindate_end">
            </td>
          </tr>
          <tr>
            <td><%= label.getLabelName("L_UM_UserName") + label.getLabelName("L_Colon") %></td>
            <td>
			        <custom:text property="username" size="12" />
			        <a href="javascript:page_summary('search')"><img src="<%= ConstantProp.DEFAULT_ROOT_PATH %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a></td>
			      </td>
  			  </tr>
        </table>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        
          <tr class="deepblue-left"> 
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','orgcode')"><%=label.getLabelName("L_OrgCode")%></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','shortname')"><%=label.getLabelName("L_OrgName")%></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','username')"><%=label.getLabelName("L_UM_UserName")%></a></td>
            <td class="title_center"><a href="javascript:page_summary('orderby','logindate')"><%=label.getLabelName("L_UM_LoginDate")%></a></td>
          </tr>
          <%
            cat.info("start loop");
            Vector usrmonitorsummary=(Vector)pageContext.getAttribute("usrmonitorsummary");
            if(usrmonitorsummary==null)
            {
                usrmonitorsummary=new Vector();
            }
            cat.debug("usrmonitorsummary is :"+usrmonitorsummary);
            String strClassType = new String("");   
            int i=0;
            String strChecked = "";
            boolean bHasChecked = false;
          %>
          <logic:iterate id="usrmonitorsummaryitem" collection="<%= usrmonitorsummary %>">
            <%
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{                    
              strClassType = "none";
            }
            if(!bHasChecked)
            {
              bHasChecked = true;
              strChecked = "Checked";
            }
            else
            {
              strChecked = "";
            }
            i++;
          %>  
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" class="<%=JspHelper.filterNull( strClassType )%>"> 
            <td>&nbsp;<oval:write name="usrmonitorsummaryitem" property="orgcode" /></a></td>
            <td>&nbsp;<oval:write name="usrmonitorsummaryitem" property="shortname" /></a></td>
            <td>&nbsp;<oval:write name="usrmonitorsummaryitem" property="username" /></a></td>
            <td>&nbsp;<%= OvalTools.dateToString((java.sql.Date)((HashMap)pageContext.getAttribute("usrmonitorsummaryitem")).get("logindate"),(String)session.getAttribute("dateformat")+" HH:mm:ss") %></td>
          </tr>
          </logic:iterate>
          <%cat.info("end loop");%>
        
          <tr> 
            <td colspan="8"> 
              <%@ include file="/inc/SummaryAction.inc" %>
            </td>
          </tr>
       
      </table>
    </td>
  </tr>
</table> 
</form>
</body>
</html>


